# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

add_library( # Sets the name of the library.
        gdx

        # Sets the library as a shared library.
        SHARED

        ./libgdx/Box2D/Collision/b2BroadPhase.cpp
        ./libgdx/Box2D/Collision/b2CollideCircle.cpp
        ./libgdx/Box2D/Collision/b2CollideEdge.cpp
        ./libgdx/Box2D/Collision/b2CollidePolygon.cpp
        ./libgdx/Box2D/Collision/b2Collision.cpp
        ./libgdx/Box2D/Collision/b2Distance.cpp
        ./libgdx/Box2D/Collision/b2DynamicTree.cpp
        ./libgdx/Box2D/Collision/b2TimeOfImpact.cpp
        ./libgdx/Box2D/Collision/Shapes/b2ChainShape.cpp
        ./libgdx/Box2D/Collision/Shapes/b2CircleShape.cpp
        ./libgdx/Box2D/Collision/Shapes/b2EdgeShape.cpp
        ./libgdx/Box2D/Collision/Shapes/b2PolygonShape.cpp
        ./libgdx/Box2D/Common/b2BlockAllocator.cpp
        ./libgdx/Box2D/Common/b2Draw.cpp
        ./libgdx/Box2D/Common/b2Math.cpp
        ./libgdx/Box2D/Common/b2Settings.cpp
        ./libgdx/Box2D/Common/b2StackAllocator.cpp
        ./libgdx/Box2D/Common/b2Timer.cpp
        ./libgdx/Box2D/Dynamics/b2Body.cpp
        ./libgdx/Box2D/Dynamics/b2ContactManager.cpp
        ./libgdx/Box2D/Dynamics/b2Fixture.cpp
        ./libgdx/Box2D/Dynamics/b2Island.cpp
        ./libgdx/Box2D/Dynamics/b2World.cpp
        ./libgdx/Box2D/Dynamics/b2WorldCallbacks.cpp
        ./libgdx/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp
        ./libgdx/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp
        ./libgdx/Box2D/Dynamics/Contacts/b2CircleContact.cpp
        ./libgdx/Box2D/Dynamics/Contacts/b2Contact.cpp
        ./libgdx/Box2D/Dynamics/Contacts/b2ContactSolver.cpp
        ./libgdx/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp
        ./libgdx/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp
        ./libgdx/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp
        ./libgdx/Box2D/Dynamics/Contacts/b2PolygonContact.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2DistanceJoint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2FrictionJoint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2GearJoint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2Joint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2MouseJoint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2RopeJoint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2WeldJoint.cpp
        ./libgdx/Box2D/Dynamics/Joints/b2WheelJoint.cpp
        ./libgdx/Box2D/Rope/b2Rope.cpp
        ./libgdx/com.badlogic.gdx.graphics.g2d.Gdx2DPixmap.cpp
        ./libgdx/com.badlogic.gdx.graphics.g3d.loaders.md5.MD5Jni.cpp
        ./libgdx/com.badlogic.gdx.graphics.glutils.ETC1.cpp
        ./libgdx/com.badlogic.gdx.math.Matrix4.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.Body.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.ChainShape.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.CircleShape.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.Contact.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.ContactImpulse.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.EdgeShape.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.Fixture.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.Joint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.joints.DistanceJoint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.joints.FrictionJoint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.joints.GearJoint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.joints.MouseJoint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.joints.PrismaticJoint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.joints.PulleyJoint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.joints.RevoluteJoint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.joints.RopeJoint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.joints.WheelJoint.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.Manifold.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.PolygonShape.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.Shape.cpp
        ./libgdx/com.badlogic.gdx.physics.box2d.World.cpp
        ./libgdx/com.badlogic.gdx.utils.BufferUtils.cpp
        ./libgdx/etc1/etc1_utils.cpp
        ./libgdx/gdx2d/gdx2d.c
        ./libgdx/gdx2d/stb_image.c

        # Provides a relative path to your source file(s).
        native-lib.cpp)

include_directories(./libgdx)

# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.

find_library( # Sets the name of the path variable.
        log-lib

        # Specifies the name of the NDK library that
        # you want CMake to locate.
        log)

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

target_link_libraries( # Specifies the target library.
        gdx

        -lm

        # Links the target library to the log library
        # included in the NDK.
        ${log-lib})
